This is the documentation of the \texttt{MODULE Error}, a set
of \texttt{FORTRAN 90} routines that allow to write errors.


\section{Defined variables}

\subsection{\texttt{stderr}}

\subsubsection{Description}

This variable has the unit number of standard error.

\subsubsection{Examples}
\begin{lstlisting}[emph=stderr,
                   emphstyle=\color{blue},
                   frame=trBL,
                   caption=Standard error unit.,
                   label=stderr]
Program Test
  USE Error

  Write(stderr,*)''This is printed in standard error.''

  Stop
End Program Test
\end{lstlisting}


\section{Subroutine \texttt{perror([routine], msg)}}
\index{perror@Subroutine \texttt{perror([routine], msg)}}

\subsection{Description}

Prints the error message \texttt{msg} in standard error. If the
optional argument \texttt{routine} is given, it is used as the routine
where the program has crashed.

\subsection{Arguments}

\begin{description}
\item[\texttt{routine}:] Character string with arbitrary length. It
  should be the routine or program name where the error has
  ocurred. It is an optional argument.
\item[\texttt{msg}:] Character string with arbitrary length. It
  should be the message that you want to print.
\end{description}


\subsection{Examples}

\begin{lstlisting}[emph=perror,
                   emphstyle=\color{blue},
                   frame=trBL,
                   caption=Print error message.,
                   label=perror]
Program Test
  USE Error

  Integer :: N1, N2

  Write(*,*)'Two integer numbers:'
  Read(*,*)N1,N2

  If (N2 == 0) Then
    CALL Perror('Test', 'Division by cero. See the product: ')
    Write(*,*)N1*N2
  Else 
    Write(*,*)N1/N2
  End If

  Stop
End Program Test
\end{lstlisting}

\section{Subroutine \texttt{abort([routine], msg)}}
\index{abort@Subroutine \texttt{abort([routine], msg)}}

\subsection{Description}

Prints the error message \texttt{msg} in standard error, and stops the
program. If the optional argument \texttt{routine} is given, it is
used as the routine where the program has crashed.

\subsection{Arguments}

\begin{description}
\item[\texttt{routine}:] Character string with arbitrary length. It
  should be the routine or program name where the error has
  ocurred. It is an optional argument.
\item[\texttt{msg}:] Character string with arbitrary length. It
  should be the message that you want to print.
\end{description}


\subsection{Examples}

\begin{lstlisting}[emph=abort,
                   emphstyle=\color{blue},
                   frame=trBL,
                   caption=Print error message and stop a program.,
                   label=abort]
Program Test
  USE Error

  Integer :: N1, N2

  Write(*,*)'Two integer numbers:'
  Read(*,*)N1,N2

  If (N2 == 0) Then
    CALL abort('Test', 'Division by cero')
  Else 
    Write(*,*)N1/N2
  End If

  Stop
End Program Test
\end{lstlisting}


% Local Variables: 
% mode: latex
% TeX-master: "lib"
% End: 
